﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BrowsableAnimationCurveAttribute.cs" company="Marcelo Roca">
//   Copyright (c) 2011 Marcelo Roca. All rights reserved.
// </copyright>
// <author name="Marcelo Roca" email="marce@marceloroca.com"/>
// <license>
//   This program is free software: you can redistribute it and/or modify
//   it under the terms of the GNU General Public License as published by
//   the Free Software Foundation, either version 3 of the License, or
//   (at your option) any later version.
// 
//   This program is distributed in the hope that it will be useful,
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//   GNU General Public License for more details.
//
//   You should have received a copy of the GNU General Public License
//   along with this program.  If not, see http://www.gnu.org/licenses/.
// </license>
// --------------------------------------------------------------------------------------------------------------------

namespace GameKits.Unity.SmartInspector
{
    using UnityEngine;

    /// <summary>
    /// Se utiliza este atributo para especificar los datos adicionales al tipo de dato
    /// AnimationCurve
    /// </summary>
    /// <remarks>
    /// Solo se verifica este atributo cuando el tipo de datos es AnimationCurve
    /// </remarks>
    public class BrowsableAnimationCurveAttribute : BrowsableFieldAttribute
    {
        /// <summary>
        /// The animation curve range
        /// </summary>
        private Rect ranges = new Rect(0, 0, 1, 1);

        /// <summary>
        /// Gets or sets Color.
        /// </summary>
        public UnityColor Color { get; set; }

        /// <summary>
        /// Gets or sets XMin.
        /// </summary>
        public float XMin
        {
            get
            {
                return this.ranges.xMin;
            }

            set
            {
                this.ranges = new Rect(value, this.ranges.yMin, this.ranges.width, this.ranges.height);
            }
        }

        /// <summary>
        /// Gets or sets YMin.
        /// </summary>
        public float YMin
        {
            get
            {
                return this.ranges.yMin;
            }

            set
            {
                this.ranges = new Rect(this.ranges.xMin, value, this.ranges.width, this.ranges.height);
            }
        }

        /// <summary>
        /// Gets or sets Widht.
        /// </summary>
        public float Widht
        {
            get
            {
                return this.ranges.width;
            }

            set
            {
                this.ranges = new Rect(this.ranges.xMin, this.ranges.yMin, value, this.ranges.height);
            }
        }

        /// <summary>
        /// Gets or sets Height.
        /// </summary>
        public float Height
        {
            get
            {
                return this.ranges.height;
            }

            set
            {
                this.ranges = new Rect(this.ranges.xMin, this.ranges.yMin, this.ranges.width, value);
            }
        }

        /// <summary>
        /// Gets Range.
        /// </summary>
        public Rect Range
        {
            get
            {
                return this.ranges;
            }
        }
    }
}
